package com.boruan.qq.zxgylibrary.service.manager;

import com.boruan.qq.zxgylibrary.service.model.AddressBackPriceBean;
import com.boruan.qq.zxgylibrary.service.model.AddressListBean;
import com.boruan.qq.zxgylibrary.service.model.DownOrderBean;
import com.boruan.qq.zxgylibrary.service.model.FirstBannerBean;
import com.boruan.qq.zxgylibrary.service.model.FirstCategoryBean;
import com.boruan.qq.zxgylibrary.service.model.InsuranceUrl;
import com.boruan.qq.zxgylibrary.service.model.OrderDetailBean;
import com.boruan.qq.zxgylibrary.service.model.PayInfoResponse;
import com.boruan.qq.zxgylibrary.service.model.PayResultBean;
import com.boruan.qq.zxgylibrary.service.model.ResponseModel;
import com.boruan.qq.zxgylibrary.service.model.SettleDefaultAddressBean;
import com.boruan.qq.zxgylibrary.service.model.ShopCarDataBean;
import com.convenient.qd.core.bean.BaseResBean;
import com.convenient.qd.core.bean.HomeResponse;
import com.convenient.qd.core.net.BaseHttpObserver;
import com.convenient.qd.core.net.RefuseHttpObserver;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PartMap;
import retrofit2.http.Query;


/**
 * Created by 崔琦 on 2019/9/2.
 * des: 网络请求接口 （请求头动态添加）
 */

public interface GXDrugApi {

    /** 获取首页轮播图 */
    @GET("drugstore/api/index/bannerList")
    Observable<BaseResBean<List<FirstBannerBean.ResultBean>>> getFirstBanner(@Query("bundleId") String bundleId, @Query("appVersion") String appVersion, @Query("sourceSystem") String sourceSystem);
    /** 获取首页分类 */
    @GET("drugstore/api/index/categoryList")
    Observable<BaseResBean<List<FirstCategoryBean.ResultBean>>> getFirstCategory(@Query("bundleId") String bundleId, @Query("appVersion") String appVersion, @Query("sourceSystem") String sourceSystem);
    /** 上传经纬度 */
    @GET("drugstore/api/user/savelocation")
    Observable<BaseResBean<ResponseModel>> saveUpdateLocation(@Query("latitude") String latitude, @Query("longitude") String longitude, @Query("bundleId") String bundleId, @Query("appVersion") String appVersion, @Query("sourceSystem") String sourceSystem);

    /** 上传经纬度1 */
    @GET("drugstore/api/user/savelocation")
    Observable<ResponseBody> saveUpdateLocationOne(@Query("latitude") String latitude, @Query("longitude") String longitude, @Query("bundleId") String bundleId, @Query("appVersion") String appVersion, @Query("sourceSystem") String sourceSystem);

    /** 保存用户地址 */
    @POST("drugstore/api/address/addNew")
    Observable<BaseResBean> addAddress(@Body RequestBody body);
    /** 获取地址列表 */
    @GET("drugstore/api/address/list")
    Observable<BaseResBean<List<AddressListBean.ResultBean>>> getAddressData(@Query("shopId") String shopId, @Query("bundleId") String bundleId, @Query("appVersion") String appVersion, @Query("sourceSystem") String sourceSystem);
    /** 删除地址 */
    @GET("drugstore/api/address/del")
    Observable<BaseResBean> deleteAddress(@Query("addressId") int id, @Query("bundleId") String bundleId, @Query("appVersion") String appVersion, @Query("sourceSystem") String sourceSystem);
    /** 修改地址 */
    @POST("drugstore/api/address/modifyNew")
    Observable<BaseResBean> modifyAddress(@Body RequestBody body);
    /** 修改默认地址 */
    @GET("drugstore/api/address/modifyDefault")
    Observable<BaseResBean> modifyDefaultAddress(@Query("addressId") int addressId, @Query("bundleId") String bundleId, @Query("appVersion") String appVersion, @Query("sourceSystem") String sourceSystem);
//    /** 获取用户在购物车选择的药品 */
//    @GET("drugstore/api/drugsCart/shopCartInfo")
//    Observable<BaseResBean<List<ShopCarDataBean.ResultBean>>> getShopCarData(@Query("shopId") String shopId, @Query("bundleId") String bundleId, @Query("appVersion") String appVersion, @Query("sourceSystem") String sourceSystem);
    /** 获取结算页默认收货地址 */
    @GET("drugstore/api/address/settle/default")
    Observable<BaseResBean<SettleDefaultAddressBean.ResultBean>> getSettleDefaultAddress(@Query("shopId") String shopId, @Query("bundleId") String bundleId, @Query("appVersion") String appVersion, @Query("sourceSystem") String sourceSystem);
    /** 判断当前地址是否支持配送,并返回配送价格和距离 */
    @GET("drugstore/api/address/canDelivery")
    Observable<BaseResBean<AddressBackPriceBean.ResultBean>> judgeDelivery(@Query("addressId") int id, @Query("shopId") String shopId, @Query("bundleId") String bundleId, @Query("appVersion") String appVersion, @Query("sourceSystem") String sourceSystem);
    /** 下单接口 */
    @POST("drugstore/api/order/add/v2")
    Observable<BaseResBean<DownOrderBean.ResultBean>> userDownOrder(@Body RequestBody body);
    /** 支付通知接口 */
    @Multipart
    @POST("drugstore/api/drugstore/notify")
    Observable<ResponseBody> payNotice(@PartMap Map<String, RequestBody> requestBodyMap);
    /** 订单详情接口，只为了取订单状态值 */
    @GET("drugstore/api/order/orderInfo")
    Observable<BaseResBean<OrderDetailBean.ResultBean>> getOrderDetailInfo(@Query("orderId") String orderId, @Query("bundleId") String bundleId, @Query("appVersion") String appVersion, @Query("sourceSystem") String sourceSystem);

    /** 国信中台支付接口 */
    @POST("v3/ucfpay/ucfpay/trade/shyTrade")
    Observable<BaseResBean<PayInfoResponse.ResultBean>> getPayParam(@Body Map<String, Object> requestBodyMap);
    /** 获取支付信息接口 */
    @POST("v3/order/show")
    Observable<BaseResBean<PayResultBean.ResultBean>> getPayResultInfo(@Body RequestBody body);


    /** 获取用户在购物车选择的药品 */
    @GET("drugstore/api/drugsCart/shopCartInfo/v2")
    Observable<BaseResBean<List<ShopCarDataBean.ResultBean>>> getShopCarData(@Query("shopId") String shopId,@Query("addressId") int addressId, @Query("bundleId") String bundleId, @Query("appVersion") String appVersion, @Query("sourceSystem") String sourceSystem);

    /** 获取医保余额接口 */
    @POST("v3/user/insurance/Balance")
    Observable<BaseResBean<InsuranceUrl>> getInsuranceBalance();

    /** 获取医保签约接口 */
    @POST("v3/user/insurance/getRegisterUrl")
    Observable<BaseResBean<InsuranceUrl>> getInsuranceRegisterUrl();
}
